package cn.iocoder.yudao.module.energy.controller.admin.report.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import cn.iocoder.yudao.module.energy.util.CustomLocalDateTimeDeserializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.PositiveOrZero;
import java.math.BigDecimal;
import java.time.LocalDateTime;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

/**
 * 能耗报告数据批量导入 VO
 */
@Data
public class EnergyReportDataBatchImportVO {

    @Schema(description = "设备ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "device123")
    @NotNull(message = "设备ID不能为空")
    private String deviceId;

    @Schema(description = "上报数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "voltage")
    @NotNull(message = "上报数据类型不能为空")
    private String reportDataType;

    @Schema(description = "上报数据实际值", requiredMode = Schema.RequiredMode.REQUIRED, example = "220.5")
    @NotNull(message = "上报数据实际值不能为空")
    private BigDecimal reportDataValue;

    @Schema(description = "上报数据级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "info")
    @NotNull(message = "上报数据级别不能为空")
    private String reportDataLevel;

    @Schema(description = "上报数据时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2023-10-31 12:00:00")
    @NotNull(message = "上报数据时间不能为空")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    @JsonDeserialize(using = CustomLocalDateTimeDeserializer.class)
    private LocalDateTime reportDataTime;
    
    @Schema(description = "累计能耗(kWh)", example = "1024.5")
    @PositiveOrZero(message = "累计能耗必须大于等于0")
    private BigDecimal energyConsumption;

    @Schema(description = "上报数据信息", example = "电压波动异常")
    private String message;

    @Schema(description = "处理状态", example = "unprocessed", defaultValue = "unprocessed")
    private String status = "unprocessed";
    
    @Schema(description = "上传标识", example = "1")
    private Integer uploadType;
}